package com.general.message.push.websocket;

import com.general.common.utils.StringUtils;

import java.util.HashSet;
import java.util.Set;

public class RecordHelper {

    private static final Set<String> set = new HashSet<>();

    /**
     * 推送按钮消息前缀标识
     */
    private static final String PUSH_PREFIX = "required:";
    private static final String PAD_PUSH_PREFIX = "required:user:";
    private static final String SCREEN_PUSH_PREFIX = "required:sc:";

    public static void recordUserKeyIfValid(String userKey) {
        if (StringUtils.isNotBlank(userKey) && userKey.startsWith(PUSH_PREFIX)) {
            set.add(userKey);
        }
    }

    public static void removeUserKeyIfValid(String userKey) {
        if (StringUtils.isNotBlank(userKey) && userKey.startsWith(PUSH_PREFIX)) {
            set.remove(userKey);
        }
    }

    public static Set<String> getSet() {
        return set;
    }

}
